package main

import "fmt"

type Circle struct {
	radius float64
}

func (c Circle) getArea() float64 {
	return 3.14 * c.radius * c.radius
}

/**
此函数不会改变外部的radius
*/
func (c Circle) changeRadius1(radius float64) {
	c.radius = radius
	fmt.Println("[func|changeRadius1][c.radius]=", c.radius, "radius:", radius)
}

/**
此函数会改变外部的radius
*/
func (c *Circle) changeRadius2(radius float64) {
	c.radius = radius
	fmt.Println("[func|changeRadius2][c.radius]=", c.radius, "radius:", radius)
}

func (c Circle) addRadius(x float64) float64 {
	fmt.Println("[func|addRadius][c.radius]=", c.radius)
	return c.radius + x
}

// func main() {
// 	var c Circle
// 	c.radius = 10

// 	area := c.getArea()
// 	fmt.Println("radius: ", c.radius, "area: ", area);
	
// 	c.changeRadius1(20)
// 	fmt.Println("radius: ", c.radius, "area: ", area);
	
// 	c.changeRadius2(30)
// 	fmt.Println("radius: ", c.radius, "area: ", area);

// 	result := c.addRadius(3.5)
// 	fmt.Println("radius: ", c.radius, "result: ", result)
// }